# -*- coding: utf-8 -*-
from db.mysql import MysqlClient
from itertools import product
from common.helper import Helper

name = "综合交通工具意外险"
mysql = MysqlClient()
prices = ["35.00", "50.00", "80.00", "120.00"]
plan = {
    "planA": {
        "days": ["1y"],
        "people_count": ["1"],
        "airplane_death": ["2000000"],
        "bus_death": [""],
        "passenger_death": ["100000"],
        "train_death": ["200000"],
        "ship_death": ["200000"]
    },
    "planB": {
        "days": ["1y"],
        "people_count": ["1"],
        "airplane_death": ["3000000"],
        "bus_death": ["50000"],
        "passenger_death": ["200000"],
        "train_death": ["300000"],
        "ship_death": ["300000"]

    },
    "planC": {
        "days": ["1y"],
        "people_count": ["1"],
        "airplane_death": ["5000000"],
        "bus_death": ["5000"],
        "passenger_death": ["300000"],
        "train_death": ["400000"],
        "ship_death": ["400000"]

    },
    "planD": {
        "days": ["1y"],
        "people_count": ["1"],
        "airplane_death": ["10000000"],
        "bus_death": ["10000"],
        "passenger_death": ["400000"],
        "train_death": ["500000"],
        "ship_death": ["500000"]

    }

}
num = 0
for k in plan:
    for v in product(plan[k]["days"],plan[k]["people_count"],plan[k]["airplane_death"],plan[k]["bus_death"],plan[k]["passenger_death"],plan[k]["train_death"],plan[k]["ship_death"]):
        data = Helper.formatProductInfo( plan[k],v )
        data["name"] = name
        data["company"] = "华泰保险"
        data["price"] = prices[num]
        Helper.mergeTable("accident",mysql,data )
        num+=1

